package com.ideafactory.client.ybservice.ybviewpager;

import android.media.MediaPlayer;
import android.os.Environment;

import com.ideafactory.client.utils.GlideImageLoader;
import com.ideafactory.client.views.FullVideoView;
import com.ideafactory.client.ybselfservice.R;
import com.ideafactory.client.ybservice.BaseFragment;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/7/25.
 */

public class CompanyVideoPager extends BaseFragment {

    private FullVideoView videoView_haibao;
    private File path;
    @Override
    protected void initData() {
        path = Environment.getExternalStorageDirectory();
        playVideo("video1.mp4");
    }
    private void playVideo(String resourc) {
        videoView_haibao.setVideoPath(path + "/"+resourc);
        videoView_haibao.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                videoView_haibao.start();
            }
        });

        videoView_haibao.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                videoView_haibao.start();
            }
        });

    }
    @Override
    protected void initID() {
        videoView_haibao= (FullVideoView) view.findViewById(R.id.videoView_haibao);
    }

    @Override
    public int setContentView() {
        return R.layout.fragment_companyvideo;
    }
}
